Repository navigation
Conversation
6 of 9 tasks
YigongQin
force-pushed
the
yigongq/nano-minf-training-forward
branch
from
October 26, 2026 19:40
c53e4d9 to
381b69f
Compare
YigongQin
force-pushed
the
yigongq/nano-minf-training-forward
branch
from
October 26, 2026 23:17
381b69f to
19d04be
Compare
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Bridge 7c984ce = Bridge main f73818d + Megatron-LM #7798 (d9b0ba0) + FlashInfer 0.7.0.post1. Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
YigongQin
force-pushed
the
yigongq/nano-minf-training-forward
branch
from
October 27, 2026 20:20
e1669aa to
3c33b9f
Compare
…perts-only recipe, FlashInfer 0.7.2.post1 + jit-cache, enable FlashInfer nightlies Signed-off-by: YigongQin <yigongq@nvidia.com>
… value pass Rename moe_match_generation_forward to moe_training_matches_inference and require the training all-to-all dispatcher, which the value pass now dispatches through. Drop the per-call kernel-weight release: Megatron-LM drops them on each optimizer step, and the log-prob pass and the step's microbatches share one build. Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
…e48 pin #7798 6e77cf3 sits on MLM main past #8213 (OptimizerConfig.__post_init__ -> validate()/finalize_optimizer_config()); the old Bridge base still called super().__post_init__() and failed in OptimizerConfig.finalize(). Signed-off-by: YigongQin <yigongq@nvidia.com>
(cherry picked from commit 8bae295) Signed-off-by: YigongQin <yigongq@nvidia.com>
…aining_forward (cherry picked from commit af560c2) Signed-off-by: YigongQin <yigongq@nvidia.com>
(cherry picked from commit 26ba31a) Signed-off-by: YigongQin <yigongq@nvidia.com>
…acking in the DAPO recipe Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
…suite Signed-off-by: YigongQin <yigongq@nvidia.com>
…nt a2a CP, NVIDIA/Megatron-LM#8935) Signed-off-by: YigongQin <yigongq@nvidia.com>
Plumb policy.megatron_cfg.cp_comm_type to the model provider. Batch-invariant mode now accepts training context_parallel_size > 1 with cp_comm_type='a2a' and no longer requires training and generation CP to match. Add the Nano MXFP8 zero-KL recipe and 3n4g suite with training at TP2 x CP4 x EP4. Signed-off-by: YigongQin <yigongq@nvidia.com>
…2a CP4 (3n4g) Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
…apacity Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: YigongQin <yigongq@nvidia.com>
Signed-off-by: Yigong Qin <yigongq@oci-hsg-cs-001-vscode-01.cm.cluster>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Extend
policy.megatron_cfg.zero_train_gen_mismatchto FlashInfer MoE experts: per-token NVFP4 (NVFP4 weights × per-token NVFP4 activations) and MXFP8. Train and generation are still bitwise identical (train/gen_kl_error == 0,train/token_mult_prob_error == 1) in a synchronous GRPO loop.The FlashInfer expert kernel is batch-invariant but not bitwise identical to TE training, so the previous preset rejected it. Megatron-Core's new
moe_inference_training_forwardmakes training use it instead. Each training MoE forward runs generation's FlashInfer kernel, on the same quantization rebuilt from the live parameters on every call. The backward comes from a TE recompute of the MoE layer (a straight-through estimator). For NVFP4, training weights and refit stay BF16; only generation's expert GEMMs (and the matching training forward) run NVFP4.Builds on #4683 (Nano MXFP8 zero-KL, merged). Shipped: a Nemotron Nano v3 per-token NVFP4 recipe and nightly, and an MXFP8-on-FlashInfer recipe and nightly. Both nightlies stay in
disabled.txtuntil the submodule pins below are on upstreammain.Important
This needs an unmerged Megatron-LM PR. For reproduction,
.gitmodulespoints the Bridge submodule at the fork branchYigongQin/Megatron-Bridge:yigongq/nano-minf-training-forward, whose Megatron-LM submodule isYigongQin/Megatron-LM:yigongq/minf-training-forward(d9b0ba0, the head of NVIDIA/Megatron-LM#7798). Both must move back to the upstream repos before merge.d9b0ba0= NVIDIA/Megatron-LM#7798 on top ofmainat9314b01, which already has #8262 (per-token NVFP4 squared-ReLU MoE), #7562, #8195 and #6076.7c984ce= upstreammain(f73818d) + one commit: Megatron-LM pind9b0ba0andflashinfer-python/flashinfer-cubin0.7.0.post1.Links
main: #8262 (per-token NVFP4 FlashInfer MoE), #7562 (hybrid MoE parity), #8195 (fp64 expert combine), #6076 (deterministic Triton autotune)What FlashInfer zero-KL needs
Everything the Nano MXFP8 zero-KL preset requires still applies. On top of that:
flashinfer-python/flashinfer-cubin0.7.0.post1mcoreextra and Bridgepyproject.toml, in lockstepflashinfer-jit-cacheinstalledmcoreextra (see below)moe_inference_training_forward=truewhenever generation uses FlashInfer with MXFP8 or NVFP4 expertstransformer_impl=inference_optimizedandinference_grouped_gemm_backend=flashinferon train and generationactivation_checkpointing,recompute_granularity=selective,moeinrecompute_modules;cuda_graph_implnotlocalinference_moe_nvfp4_recipe,inference_moe_token_dispatcher_typeandexpert_model_parallel_sizeon both sidesinference_moe_nvfp4_recipe=per_tokenfp8_cfgdisabled, note_precision_config_file)moe_inference_training_max_tokens_per_rankmb_tokensflashinfer-jit-cache0.7.0 is a meta-package over per-architecture wheels (flashinfer-jit-cache-sm80…sm121a) on the explicitflashinfer-cu130index, which uv only uses for direct dependencies mapped to it. Rather than list and map all of them, themcoreextra dropsflashinfer-jit-cache. Per-token NVFP4 doesn't need it (Megatron-Core skips the check for its CuTe DSL JIT kernels), but the FlashInfer MXFP8 path does, so the MXFP8-on-FlashInfer recipe can't run in the defaultmcoreenvironment yet.What changed
nemo_rl/models/megatron/zero_train_gen_mismatch.py:moe_inference_training_forwardis on, and_validate_inference_training_forwardchecks the requirements above.generation_only=True. Their merged config clears the training-only flag, so the "requiresmoe_inference_training_forward" rule is left to the driver, which sees the full config.nemo_rl/models/megatron/setup.py: passesinference_moe_nvfp4_recipe,moe_inference_training_forwardand the derived token bound to the model config.nemo_rl/models/generation/megatron/config.py:merged_inference_megatron_cfgclearsmoe_inference_training_forwardfor generation.nemo_rl/models/policy/__init__.py: the three newMegatronConfigkeys;te_precision_config_fileacceptsnull.nemo_rl/models/policy/workers/megatron_policy_worker.py: passesgeneration_only=is_refit_destination.pyproject.toml/uv.lock: FlashInfer 0.7.0.post1 in themcoreextra, withoutflashinfer-jit-cache; the lock also picks up the Bridge bump (nccl-extensionsfrom Megatron-LM, Pillow 13).grpo-nanov3-30BA3B-2n4g-megatron_generation-noncolocated-zero-kl-mxfp8-flashinfer(on the Nano MXFP8 zero-KL recipe) and...-zero-kl-nvfp4-flashinfer(directly ongrpo_math_1B.yaml), both intests/test_suites/disabled.txtfor now.Validation
tests/unit/models/megatron/test_zero_train_gen_mismatch.py,tests/unit/models/megatron/test_megatron_setup.py.train/gen_kl_errorwas exactly 0, andtrain/token_mult_prob_error,train/probs_ratio_minandtrain/probs_ratio_maxwere exactly 1 on all 5 steps.flashinfer-jit-cache(above).